package com.webinsky.article.domain;

public enum MisRelationshipType {
	Item(0, "item"), Catalog(1, "catalog"), Hotspot(3, "hotspot"), RelateVideo(4, "relateVideo"), RelateArticle(5, "relateArticle"), Tag(6, "tag"), Tagcat(7, "tagcat");
	
	private String strType;
	private int intType;
	
	private MisRelationshipType(int intType, String strType) {
		this.intType = intType;
		this.strType = strType;
	}
	
	public String getType() {
		return strType;
	}
	
	public int getIntType(){
		return intType;
	}
	
	public static MisRelationshipType parse(int type){
		for ( MisRelationshipType misType : MisRelationshipType.values() ) {
			if ( misType.getIntType() == type ) {
				return misType;
			}
		}
		return null;
	}
	
	public static MisRelationshipType parse(String type) {
		for ( MisRelationshipType misType : MisRelationshipType.values() ) {
			if ( misType.getType().equalsIgnoreCase(type) ) {
				return misType;
			}
		}
		return null;
	}
}
